package com.lh.controller;

import com.lh.service.OssService;
import com.lh.commonutils.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

/**
 * @author YMS
 * @date 2021/6/4
 */
@RestController
@RequestMapping("/eduoss/fileoss")
@Api(description = "阿里云")
//@CrossOrigin
public class OssController {

    @Resource
    private OssService ossService;

    @PostMapping
    @ApiOperation(value = "文件上传")
    public R uploadOssFile(MultipartFile file){

        String s = ossService.uploadFileAvatar(file);
        return R.ok().message("文件上传成功").data("url",s);
    }
}
